package com.hc.contorl;

import com.hc.pojo.TbUser;
import com.hc.service.TbUserService;
import com.hc.service.impl.TbUserServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(value="/userUpdate")
public class UserUpdateContorller extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id = req.getParameter("id");
        TbUserService service = new TbUserServiceImpl();
        TbUser user = service.findById(Long.parseLong(id));
        req.setAttribute("tbuser", user);
        req.getRequestDispatcher("user_form.jsp").forward(req, resp);
    }

}
